<template>
	<view class="activityBox">
		
		
		<!-- 搜索 -->
		<view class="searchBox" @click="tiaosou">
			<view class="inputBox">
				<image src="/static/pages/index/searchImg.png" mode="" class="searchImg"></image>
				<input disabled="true" class="inpt" placeholder="请输入活动名称"
					placeholder-style="color:#9DA0A9;font-size:26rpx;" />
			</view>
			<view class="searchInput">
				搜索
			</view>
		</view>
		<!-- 内容 -->
		<view class="activityContent">
			<view class="activityList" v-for="(item,index) in list" @click="xiangqing(item)">
				<view class="ctime">
					<text class="ctimew">活动时间:</text>
					<text style="margin-left: 20rpx;">{{item.activitytime}}</text>
				</view>
				<view class="wire">
					
				</view>
				<view class="acName">
					{{item.activity_name}}
				</view>
				<!-- <view class="fundsNum">
					<view class="fundsNum1">
						预算：
					</view>
					<view class="fundsNum2">
						{{item.money}}
					</view>
				</view> -->
				<view class="quota">
					<view class="quota1">
						剩余场次:
					</view>
					<view class="quota2">
						{{item.remaining}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var app =getApp()
	import {fanguiList} from '@/request/api.js'
	export default {
		data() {
			return {
				contentList: [{
						ctime: "2021.09.01-2021.12.31",
						acName: '活动名称活动名称活动名称',
						fundsNum: '1200', //预算
						quota: '4', //剩余场次
					},
					{
						ctime: "2021.09.01-2021.12.31",
						acName: '活动名称活动名称活动名称',
						fundsNum: '1200', //预算
						quota: '4', //剩余场次
					},
					{
						ctime: "2021.09.01-2021.12.31",
						acName: '活动名称活动名称活动名称',
						fundsNum: '1200', //预算
						quota: '4', //剩余场次
					},
					{
						ctime: "2021.09.01-2021.12.31",
						acName: '活动名称活动名称活动名称',
						fundsNum: '1200', //预算
						quota: '4', //剩余场次
					},
					{
						ctime: "2021.09.01-2021.12.31",
						acName: '活动名称活动名称活动名称',
						fundsNum: '1200', //预算
						quota: '4', //剩余场次
					}

				],
				list:[],
				list1:''
			};
		},
		onShow() {
			let that = this
			that.getList()
		},
		methods:{
			xiangqing:function(item){
				uni.navigateTo({
					// url:'fankui_detail?id='+item.id
					url:'fankui_detail?id='+item.id
				})
				
			},
			 getList(){
				 let that = this
				 var user=uni.getStorageSync('regionMessage')
				 console.log(user)
				 let data={
					 user_id:user.id,
					 status:2,
					 type:1
				 }
				 fanguiList(data).then(res=>{
					 console.log(res)
					 // res.data.data.forEach((item)=>{
						//  let timestamp = item.activitytime
						//  item.activitytime=app.time1(timestamp)
					 // })
					 that.list=res.data.data
					 res.data.data.forEach(item=>{
					 	console.log(item,'时间时间')
					 	if(item){
					 	item.activitytime=that.formatDate(item.activitytime)
					 	// item.activity.endtime_text=item.activity.endtime_text.slice(0,10)
					 	
					 	}
					 })
				 }).catch(err=>{
					 
				 })
			 },
			
			tiaosou:function(){
				uni.navigateTo({
					url:'/pages/groundPole/activityGround/activitySearch'
				})
			},
			formatDate: function(value) {
				let date = new Date(value * 1000);
				//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				MM = MM < 10 ? ('0' + MM) : MM; //月补0
				let d = date.getDate();
				d = d < 10 ? ('0' + d) : d; //天补0
				let h = date.getHours();
				h = h < 10 ? ('0' + h) : h; //小时补0
				let m = date.getMinutes();
				m = m < 10 ? ('0' + m) : m; //分钟补0
				let s = date.getSeconds();
				s = s < 10 ? ('0' + s) : s; //秒补0
				console.log(y + '-' + MM + '-' + d);
				return y + '-' + MM + '-' + d; //年月日
					
			},
			
			
		}
		
		
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.activityBox {
		width: 100%;
		box-sizing: border-box;
		padding-bottom: 40rpx;
		.searchBox {
			width: 100%;
			display: flex;
			justify-content: space-around;
			margin-top: 26rpx;

			.inputBox {
				width: 580rpx;
				height: 70rpx;
				background-color: #F0F1F5;
				border-radius: 60rpx;
				display: flex;

				.searchImg {
					width: 28rpx;
					height: 28rpx;
					margin: 21rpx 21rpx 0 24rpx;
				}

				.inpt {
					margin-top: 15rpx;
				}
			}

			.searchInput {
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #2E2F33;
				margin-right: 40rpx;
				margin-top: 17rpx;
			}
		}
		.activityContent{
			width: 100%;
			overflow: hidden;
			.activityList{
				width: 670rpx;
				// height: 330rpx;
				padding-bottom:30rpx;
				margin: 40rpx auto 0;
				background: #FFFFFF;
				box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(211, 213, 220, 0.4);
				border-radius: 24rpx;
				overflow: hidden;
				.ctime{
					color: #979BA6;
					font-size: 26rpx;
					height: 70rpx;
					line-height: 70rpx;
					padding-left: 22rpx;
					border-bottom: 2rpx solid #ebecee;
				}
				// .wire{
				// 	background-color: #ebecee;
				// 	width: 100%;
				// 	height: 4rpx;
				// 	margin-top: 23rpx;
				// }
				.acName{
					font-size: 36rpx;
					color: #313233;
					margin-top: 29rpx;
					margin-left: 22rpx;
					line-height: 36rpx;
				}
				.fundsNum{
					display: flex;
					margin-top: 49rpx;
					margin-left: 22rpx;
					line-height: 36rpx;
					.fundsNum1{
						color: #313233;
						font-size: 36rpx;
					}
					.fundsNum2{
						color: #313233;
						font-size: 36rpx;
						margin-left: 123rpx;
						line-height: 36rpx;
					}
				}
				.quota{
					display: flex;
					margin-top: 49rpx;
					margin-left: 22rpx;
					.quota1{
						color: #313233;
						font-size: 36rpx;
					}
					.quota2{
						color: #313233;
						font-size: 36rpx;
						margin-left: 145rpx;
					}
				}
			}
		}
	}
</style>
